﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Util.Ui.Trees;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.Systems {
    /// <summary>
    /// 行政区域数据传输对象
    /// </summary>
    [DataContract]
    public class DistrictDto : TreeDtoBase {
        /// <summary>
        /// 编码
        /// </summary>
        [Required(ErrorMessage = "编码不能为空")]
        [StringLength( 10, ErrorMessage = "编码输入过长，不能超过10位" )]
        [Display( Name = "编码" )]
        [DataMember]
        public string Code { get; set; }
        
        /// <summary>
        /// 父编码
        /// </summary>
        [StringLength( 10, ErrorMessage = "父编码输入过长，不能超过10位" )]
        [Display( Name = "父编码" )]
        [DataMember]
        public string ParentCode { get; set; }
        
        /// <summary>
        /// 名称
        /// </summary>
        [Required(ErrorMessage = "名称不能为空")]
        [StringLength( 200, ErrorMessage = "名称输入过长，不能超过200位" )]
        [Display( Name = "名称" )]
        [DataMember]
        public string Name { get; set; }
        
        /// <summary>
        /// 合并名称
        /// </summary>
        [Required(ErrorMessage = "合并名称不能为空")]
        [StringLength( 500, ErrorMessage = "合并名称输入过长，不能超过500位" )]
        [Display( Name = "合并名称" )]
        [DataMember]
        public string MergerName { get; set; }
        
        /// <summary>
        /// 短名称
        /// </summary>
        [Required(ErrorMessage = "短名称不能为空")]
        [StringLength( 500, ErrorMessage = "短名称输入过长，不能超过500位" )]
        [Display( Name = "短名称" )]
        [DataMember]
        public string ShortName { get; set; }
        
        /// <summary>
        /// 合并短名称
        /// </summary>
        [Required(ErrorMessage = "合并短名称不能为空")]
        [StringLength( 500, ErrorMessage = "合并短名称输入过长，不能超过500位" )]
        [Display( Name = "合并短名称" )]
        [DataMember]
        public string MergerShortName { get; set; }
        
        /// <summary>
        /// 区号
        /// </summary>
        [StringLength( 4, ErrorMessage = "区号输入过长，不能超过4位" )]
        [Display( Name = "区号" )]
        [DataMember]
        public string TelCode { get; set; }
        
        /// <summary>
        /// 邮编
        /// </summary>
        [StringLength( 6, ErrorMessage = "邮编输入过长，不能超过6位" )]
        [Display( Name = "邮编" )]
        [DataMember]
        public string ZipCode { get; set; }
        
        /// <summary>
        /// 拼音简码
        /// </summary>
        [Required(ErrorMessage = "拼音简码不能为空")]
        [StringLength( 200, ErrorMessage = "拼音简码输入过长，不能超过200位" )]
        [Display( Name = "拼音简码" )]
        [DataMember]
        public string PinYin { get; set; }
        
        /// <summary>
        /// 全拼
        /// </summary>
        [Required(ErrorMessage = "全拼不能为空")]
        [StringLength( 500, ErrorMessage = "全拼输入过长，不能超过500位" )]
        [Display( Name = "全拼" )]
        [DataMember]
        public string FullPinYin { get; set; }
        
        /// <summary>
        /// 英文
        /// </summary>
        [Required(ErrorMessage = "英文不能为空")]
        [StringLength( 200, ErrorMessage = "英文输入过长，不能超过200位" )]
        [Display( Name = "英文" )]
        [DataMember]
        public string English { get; set; }
        
        /// <summary>
        /// 经度
        /// </summary>
        [Required(ErrorMessage = "经度不能为空")]
        [Display( Name = "经度" )]
        [DataMember]
        public decimal Longitude { get; set; }
        
        /// <summary>
        /// 纬度
        /// </summary>
        [Required(ErrorMessage = "纬度不能为空")]
        [Display( Name = "纬度" )]
        [DataMember]
        public decimal Latitude { get; set; }
        
        /// <summary>
        /// 编码路径
        /// </summary>
        [Required(ErrorMessage = "编码路径不能为空")]
        [StringLength( 800, ErrorMessage = "编码路径输入过长，不能超过800位" )]
        [Display( Name = "编码路径" )]
        [DataMember]
        public string CodePath { get; set; }
        
        /// <summary>
        /// 版本号
        /// </summary>
        [Display( Name = "版本号" )]
        [DataMember]
        public Byte[] Version { get; set; }
        
        /// <summary>
        /// 输出行政区域状态
        /// </summary>
        public override string ToString() {
            return this.ToEntity().ToString();
        }
    }
}
